import React from 'react'
import {
    useOutlet,
    useLocation,
    useNavigate,
    useParams
} from 'react-router-dom'

function withRouter(Com) {

  return (props) => {
    const outlet = useOutlet()
    const location = useLocation()
    const  params = useParams()
    const navigate = useNavigate()

    return <Com {...props} router={{outlet,location,params,navigate}}></Com>
  }
}

export default withRouter